<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%commonmodel}}".
 *
 * @property integer $GeneralID
 * @property integer $NodeID
 * @property integer $ModelID
 * @property integer $ItemID
 * @property string $TableName
 * @property string $Title
 * @property string $Inputer
 * @property integer $Hits
 * @property integer $DayHits
 * @property integer $WeekHits
 * @property integer $MonthHits
 * @property integer $LinkType
 * @property string $UpdateTime
 * @property string $CreateTime
 * @property string $TemplateFile
 * @property integer $Status
 * @property integer $EliteLevel
 * @property integer $Priority
 * @property integer $CommentAudited
 * @property integer $CommentUnAudited
 * @property integer $SigninType
 * @property string $InputTime
 * @property string $PassedTime
 * @property string $Editor
 * @property string $LastHitTime
 * @property string $DefaultPicUrl
 * @property string $PinyinTitle
 * @property string $TitleFontColor
 * @property string $TitleFontType
 * @property string $IncludePic
 * @property integer $ShowCommentLink
 * @property string $TitleHashKey
 * @property string $HtmlPageName
 * @property integer $SGType
 * @property integer $SGDataId
 */
class DhCommonmodel extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%commonmodel}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['GeneralID', 'NodeID', 'ModelID', 'Title'], 'required'],
            [['GeneralID', 'NodeID', 'ModelID', 'ItemID', 'Hits', 'DayHits', 'WeekHits', 'MonthHits', 'LinkType', 'Status', 'EliteLevel', 'Priority', 'CommentAudited', 'CommentUnAudited', 'SigninType', 'ShowCommentLink', 'SGType', 'SGDataId'], 'integer'],
            [['UpdateTime', 'CreateTime', 'InputTime', 'PassedTime', 'LastHitTime'], 'safe'],
            [['PinyinTitle'], 'string'],
            [['TitleHashKey'], 'number'],
            [['TableName', 'Title', 'Inputer', 'TemplateFile', 'Editor', 'DefaultPicUrl', 'TitleFontColor', 'TitleFontType', 'IncludePic', 'HtmlPageName'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'GeneralID' => '内容全局ID',
            'NodeID' => '节点ID',
            'ModelID' => '模型ID',
            'ItemID' => '相应表的记录ID',
            'TableName' => '模型表名',
            'Title' => '标题',
            'Inputer' => '来源',
            'Hits' => '点击数',
            'DayHits' => '日点击数',
            'WeekHits' => '周点击数',
            'MonthHits' => '月点击数',
            'LinkType' => '链接类型',
            'UpdateTime' => '更新时间',
            'CreateTime' => '生成时间',
            'TemplateFile' => '该文章所使用的模板路径',
            'Status' => '信息状态 -3为删除，-2为退稿，-1为草稿，0为待审核，99为终审通过，其它为自定义',
            'EliteLevel' => '推荐级别',
            'Priority' => '优先级别',
            'CommentAudited' => '通过审核的评论总数',
            'CommentUnAudited' => '未通过审核的评论总数',
            'SigninType' => '签收类型',
            'InputTime' => '文章录入时间',
            'PassedTime' => '审核通过时间',
            'Editor' => '编辑',
            'LastHitTime' => '上次点击时间',
            'DefaultPicUrl' => '默认首页图片',
            'PinyinTitle' => '拼音标题',
            'TitleFontColor' => '标题字体颜色',
            'TitleFontType' => '标题字形',
            'IncludePic' => '标题前缀  1--[图文]  2--[组图]  3--[推荐]  4--[注意]',
            'ShowCommentLink' => '列表显示时是否在标题旁显示“评论”链接',
            'TitleHashKey' => '标题Hash值',
            'HtmlPageName' => '静态页名称',
            'SGType' => '站群信息类型',
            'SGDataId' => '站群数据ID',
        ];
    }
    
    public static function getCate($params) {
      
            $res = DhNodes::findOne([ 'NodeID' => $params]);
            if ($res) {
             
                $temp = $res->attributes['NodeName'];
            } else {
                $temp = "未知";
            }
        
        return $temp;
    }
}
